<?php
// +----------------------------------------------------------------------
// | EtrolPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Author:LJQ <liujiqi@etrol.com>
// +-----------------------------------------------------------------------

namespace app\basic\model;

use app\common\model\Base;
/**
 * 模型基类
 */
class Chemical extends Base{
	

	protected $name = 'chemicaldata';
	protected $createTime = 'createTime';
	protected $updateTime = 'updateTime';
	public $chemicalTypeList=[] ;

	// = [1=>'爆炸品',2=>'压缩气体和液化气体',3=>'易燃液体',4=>'易燃固体',5=>'自燃物品和遇湿易燃物品',6=>'氧化剂和有机过氧化物',7=>'有毒品',8=>'放射性物品',9=>'腐蚀品'];

	public  function getType(){

	 $chemicalType=db('basicinfo')->where(array('sysCode'=>34))->column('subsystemName','subsystemNo');
	 $this->chemicalTypeList=$chemicalType;
	 return $this->chemicalTypeList;
	}



	public function getTypeIdAttr($value,$data){
		$this->getType();
		if($data['typeId']){
			return $this->chemicalTypeList[$data['typeId']];
		}
		return null;
	}

	public  function  chemicals(){

		return $this->hasMany('Accesschemical','chemicalId','id');

}

}